/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package callProcs;
import Asesor.BuscarEditar_asesor;
import bufete.BufeteView;
import java.math.BigInteger;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author Juls
 */
public class ProcsAsesores {
    //java.sql.Connection  con = null;
    public ProcsAsesores(){
        
    }
     public java.sql.ResultSet verAsesores(String sentencia) throws SQLException{
         java.sql.Connection  con = null;
         con = DriverManager.getConnection("jdbc:mysql://localhost/bufete","root","bufetepopular");
         java.sql.ResultSet rs = null ;
            
            Statement cs = con.createStatement();
            rs = cs.executeQuery("SELECT idAsesor,concat(Nombre_asesor,' ',Apellido_asesor) as nombrec, Nombre_asesor, Apellido_asesor,"
                    + "Telefono_asesor, email_asesor, en_activo "
                    + " FROM asesor  where  concat(Nombre_asesor,' ',Apellido_asesor) like '%"+sentencia+"%'");
        return rs;
     }
    
    public void ActualizarAsesor(String IdAse, String Nombre,String Apellido ,String Tel,String Email, String Activo){
        java.sql.Connection  con = null;
        try {
            con = DriverManager.getConnection("jdbc:mysql://localhost/bufete","root","1234");
            java.sql.CallableStatement cs = con.prepareCall("{call Actualiza_asesor("+IdAse+",'"+Nombre+"','"+Apellido+"','"+Tel+"','"+Email+"',"+Activo+")}");
            java.sql.Statement stmt  = con.createStatement();
            java.sql.ResultSet rs = cs.executeQuery();
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditar_asesor.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
